string getHistory(History h) {
    HistoryType ht = h.type 
    string retString = goodStringOf ht
    return retString
} 

History h
string hist = ""
string result = ""
Buffer b = create
string temp
int crtd = 0
int moved = 0
int modf = 0
int count = 0


for h in obj do
{ 
  hist = getHistory h
  count ++

//Check the first entry - may indicate creation or retrofitting (via an undelete of a reserved object)
  if (count == 1) {
	if (hist == "Create Object" || hist == "Copy Object") result = "Created"
	if (hist == "Undelete Object") result = "Retrofitted"
	if (!null result) crtd = 1
  }

//If not created/retrofitted, loop through all looking for mods/moves
  if (crtd == 0) {
	if ((hist == "Move Object" || hist == "Arrange Module") && moved == 0) {
		if (!null result) result = result ", "
		result = result "Moved"
		moved = 1}

	if (hist == "Modify Object" && modf == 0 && h.attrName != "Deletion Marker") {
		if (!null result) result = result ", "
		result = result "Modified"
		modf = 1}
	}

//Look if marked deleted - this is checked whether already seen as created or modified, and overrides any such
  if (hist == "Modify Object" && h.attrName == "Deletion Marker")  {
	if (exists attribute "Deletion Marker")  {
	  temp = obj."Deletion Marker"
	  if (length temp > 0) {
		result = "Marked for Deletion"  // Overrides any previous value and breaks out of loop
		continue}
	}
  }
}  

b = result 
if(!null b)
{
	obj.attrDXLName = richText tempStringOf b
	delete b
}